﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    //public _Default()
    //{
    //    //当Page指令中的属性AutoEventWireup为false的时候，可以注册事件相应的处理方法
    //    PreInit += Page_PreInit;
    //    Init += Page_Init;
    //    InitComplete += Page_InitComplete;
    //    PreLoad += Page_PreLoad;
    //    Load += Page_Load;
    //    LoadComplete += Page_LoadComplete;
    //}
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Response.Write("调用PreInit事件处理方法Page_PreInit<br>");
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        Response.Write("调用Init事件处理方法Page_Init<br>");
    }
    protected void Page_InitComplete(object sender, EventArgs e)
    {
        Response.Write("调用InitComplete事件处理方法Page_InitComplete<br>");
    }
    protected void Page_PreLoad(object sender, EventArgs e)
    {
        Response.Write("调用PreLoad事件处理方法Page_PreLoad<br>");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("调用Load事件处理方法Page_Load<br>");
        Response.Write(IsPostBack+"<br>");
        if(!IsPostBack)//都有这一行，在页面第一次加载的时候初始化相关控件
        {
            Label1.Text = "初始值";
        }
    }
    protected void Page_LoadComplete(object sender, EventArgs e)
    {
        Response.Write("调用LoadComplete事件处理方法Page_LoadComplete<br>");
    }

    //protected override void OnLoad(EventArgs e)
    //{
    //    base.OnLoad(e);
    //    Response.Write("重写Page类当中的OnLoad方法<br>");
    //}

    protected void Button1_Load(object sender, EventArgs e)
    {
        Response.Write("Button控件加载事件<br>");
    }


    protected void TextBox1_Load(object sender, EventArgs e)
    {
        Response.Write("TextBox控件加载事件<br>");
    }



    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write("Button控件点击事件<br>");
    }

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        Response.Write("TextBox控件变化事件<br>");
        Label1.Text = TextBox1.Text;
    }
}
   